/**
 * Created by 李柏霖
 * 2020/10/16 19:44
 */

package com.lbl.service.impl;

import com.lbl.dao.IPersonDao;
import com.lbl.domain.Person;
import com.lbl.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PersonServiceImpl implements IPersonService {

    @Autowired
    IPersonDao personDao;

    @Override
    public List<Person> findAll() {
        List<Person> list = personDao.findAll();
        return list;
    }

    @Override
    public void save(Person person) {
        System.out.println("save");
    }

    @Override
    public void savePersons(List<Person> people) {
        for (int i = 0; i <people.size() ; i++) {
//            if (i == 1) {
//                System.out.println(1/0);
//            }
            personDao.save(people.get(i));
        }
    }
}
